package com.aceitunaproject.server.time.tick;

import java.io.Serializable;
import java.util.logging.Logger;

import com.sun.sgs.app.AppContext;
import com.sun.sgs.app.ManagedObject;
import com.sun.sgs.app.Task;

public class TickerTask implements Task,ManagedObject,Serializable {


	private static final long serialVersionUID = 4500509634430440799L;
	/**
	 * The current tick
	 */
	private double currentTick = 0;
	
	@Override
	public void run() throws Exception {
		AppContext.getDataManager().markForUpdate(this);
		currentTick++;
		Logger.getLogger(this.getClass().getName()).info(String.valueOf(currentTick));

	}
	
	public double getCurrentTick()
	{
		return currentTick;
	}

}
